<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="/view/template.xhtml">
        <ui:define name="head">
            <script type="text/javascript">
                    function handleSaveRequest(xhr, status, args) {
                            if(args.success) {
                                    orderDialog.hide();
                            } else if(args.duplicate ){
                                    accountDialog.show();
                                     orderDialog.hide();
                            }
                    }

                      function handleAddCommodityToPackage(xhr, status, args) {
                            if(args.success) {
                                    packageCommdoitiesDialog.show();
                            } 
                    }
                    function handleSaveOrderCommodityForRetrieveRequest(xhr, status, args) {
                            if(args.success) {
                                    orderCommdoitiesForRetrieveDialog.hide();
                            } 
                    }

                     function handleEdityOrderCommodity(xhr, status, args) {
                            if(args.success) {
                                    orderCommdoitiesDialog.show();
                            }
                    }
            </script>
        </ui:define>
        <ui:define name="content">
            <f:view>
                <h:form id ="form1">
                    <p:dataTable value="#{orderManager.orders}" var="item" id="orders" paginator="true" rows="20"
                                 selectionMode="single" selection="#{orderManager.selectedOrder}"
                                 update="form2:display,form2:orderCommodities,form2:subOrderCommodities" onselectComplete="orderDialog.show()">
                        <f:facet name="header">
                            <h:panelGrid columns="2">
                                <p:breadCrumb preview="true" expandEffectDuration="200" previewWidth="20" style="width: 500px" expandedBeginningItems="1" expandedEndItems="0">
                                    <p:menuitem value="选项"/>
                                    <p:menuitem value="拍照开单" actionListener="#{orderManager.createOrder}" oncomplete="orderDialog.show();" update="form2:display,form2:orderCommodities,form2:subOrderCommodities"/>
                                    <p:menuitem value="查询客户并开单" actionListener="#{orderManager.createOrder}" oncomplete="accountDialog.show();" update="form2:display,form2:orderCommodities,form2:subOrderCommodities"/>
                                    <p:menuitem value="今日开单" actionListener="#{orderManager.findToday}" update="form1:orders"/>
                                    <p:menuitem value="本周开单" actionListener="#{orderManager.findWeek}" update="form1:orders"/>
                                    <p:menuitem value="本月开单" actionListener="#{orderManager.findMonth}" update="form1:orders"/>
                                </p:breadCrumb>
                                <h:panelGrid columns="4" style="width: 300px">
                                    <h:outputLabel value="模糊查询"></h:outputLabel>
                                    <h:inputText value="#{orderManager.searchContent}" title="可输入部分单号,男宾或女宾的姓名与电话进行查询"></h:inputText>
                                    <p:commandLink update="form1:orders" actionListener="#{orderManager.search}" title="查询">
                                        <p:graphicImage value="/resources/images/search.png"/>
                                    </p:commandLink>
                                    <p:ajaxStatus  style="width:16px;height:16px;">
                                        <f:facet name="start">
                                            <h:graphicImage  value="/resources/images/ajaxloading.gif" />
                                        </f:facet>
                                        <f:facet name="complete">
                                            <h:outputText value=""/>
                                        </f:facet>
                                    </p:ajaxStatus>
                                </h:panelGrid>
                            </h:panelGrid>
                        </f:facet>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="序号"/>
                            </f:facet>
                            <h:outputText value="#{item.number}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="男宾姓名"/>
                            </f:facet>
                            <h:outputText value="#{item.account.mname}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="男宾电话"/>
                            </f:facet>
                            <h:outputText value="#{item.account.mphone}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="女宾姓名"/>
                            </f:facet>
                            <h:outputText value="#{item.account.fname}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="女宾电话"/>
                            </f:facet>
                            <h:outputText value="#{item.account.fphone}">

                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="固定电话"/>
                            </f:facet>
                            <h:outputText value="#{item.account.phone}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="结婚日期"/>
                            </f:facet>
                            <h:outputText value="#{item.marriageDate}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="拍照时间"/>
                            </f:facet>
                            <h:outputText value="#{item.shotTime}">
                                <f:convertDateTime pattern="yyyy/MM/dd" />
                            </h:outputText>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="选片时间"/>
                            </f:facet>
                            <h:outputText value="#{item.selectTime}">
                                <f:convertDateTime pattern="yyyy/MM/dd" />
                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="取件时间"/>
                            </f:facet>
                            <h:outputText value="#{item.getTime}">
                                <f:convertDateTime pattern="yyyy/MM/dd" />
                            </h:outputText>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="创建时间"/>
                            </f:facet>
                            <h:outputText value="#{item.createdTime}">
                                <f:convertDateTime pattern="yyyy/MM/dd" />
                            </h:outputText>
                        </p:column>
                    </p:dataTable>
                </h:form>

                <p:dialog header="编辑订单" widgetVar="orderDialog"
                          modal="true" draggable="false" width="1020" closeListener="#{orderManager.cancellCreate}" resizable="false">
                    <p:layout  style="width:1000px;height:600px; " >
                        <p:layoutUnit position="center" resizable="false" width="700" scrollable="true">
                            <h:form id="form2" >
                                <h:panelGrid  id="display" style="font-size: 75%" >
                                    <h:panelGrid columns="6"  columnClasses="column1,column2,column1,column2,column1,column2">
                                        <h:outputLabel value="单号:" for="number" />
                                        <h:outputLabel id="number" value="#{orderManager.selectedOrder.number}" title="number" />
                                        <h:outputLabel value="开单人:" for="createdBy" />
                                        <h:inputText id="createdBy" value="#{orderManager.selectedOrder.createdBy.name}" title="createdBy"  disabled="true"/>
                                        <h:outputLabel value="开单时间:" for="createdTime" />
                                        <h:inputText id="createdTime" value="#{orderManager.selectedOrder.createdTime}" title="createdTime"  disabled="true"/>

                                        <h:outputLabel value="退单" for="cancelled" />
                                        <h:selectBooleanCheckbox id="cancelled" value="#{orderManager.selectedOrder.cancelled}" />

                                        <h:outputLabel value="男宾姓名:" for="mname" />
                                        <h:inputText id="mname" value="#{orderManager.selectedOrder.account.mname}" title="Mname" />
                                        <h:outputLabel value="女宾姓名:" for="fname" />
                                        <h:inputText id="fname" value="#{orderManager.selectedOrder.account.fname}" title="Fname" />
                                        <h:outputLabel value="结婚日期:" for="marriageDate" />
                                        <p:calendar id="marriageDate" value="#{orderManager.selectedOrder.account.marriageDate}" pattern="yyyy-MM-dd" ></p:calendar>

                                        <h:outputLabel value="男宾电话:" for="mphone" />
                                        <p:inputMask id="mphone" value="#{orderManager.selectedOrder.account.mphone}" title="Mphone" mask="999999999"  />
                                        <h:outputLabel value="女宾电话:" for="fphone" />
                                        <p:inputMask id="fphone" value="#{orderManager.selectedOrder.account.fphone}" title="Fphone" mask="999999999" />
                                        <h:outputLabel value="固定电话:" for="phone" />
                                        <p:inputMask id="phone" value="#{orderManager.selectedOrder.account.phone}" title="Phone" mask="9999999"/>

                                        <h:outputLabel value="拍照时间:" for="shotTime" />
                                        <p:calendar id="shotTime" value="#{orderManager.selectedOrder.shotTime}" pattern="yyyy-MM-dd" requiredMessage="请填写拍照时间" ></p:calendar>
                                        <h:outputLabel value="选件时间:" for="selectTime" />
                                        <p:calendar id="selectTime" value="#{orderManager.selectedOrder.selectTime}" pattern="yyyy-MM-dd" ></p:calendar>
                                        <h:outputLabel value="取件时间:" for="getTime" />
                                        <p:calendar id="getTime" value="#{orderManager.selectedOrder.getTime}" pattern="yyyy-MM-dd" ></p:calendar>


                                        <h:outputLabel value="拍照数量:" for="shotAmount" />
                                        <h:inputText id="shotAmount" value="#{orderManager.selectedOrder.shotAmount}" disabled="true"  validatorMessage="拍照数量必须大于0">
                                            <f:validateLength minimum="1"></f:validateLength>
                                        </h:inputText>
                                        <h:outputLabel value="应收款:" for="receivable"/>
                                        <h:inputText id="receivable" value="#{orderManager.selectedOrder.totalAmount}" title="Fname" disabled="true" />
                                        <h:outputLabel value="已收款:" for="payment" />
                                        <h:inputText id="payment" value="#{orderManager.selectedOrder.totalPayment}" title="Fname"  disabled="true" />
                                        <h:outputLabel value="已退款:" for="expense" />
                                        <h:inputText id="expense" value="#{orderManager.selectedOrder.totalExpense}" title="Fname"  disabled="true"/>
                                        <h:outputLabel value="介绍人:" for="introducer"/>
                                        <h:selectOneMenu id ="introducer" value="#{orderManager.selectedOrder.introducer}">
                                            <f:selectItems value="#{applicationBean.employeeSelectItems}"></f:selectItems>
                                        </h:selectOneMenu>
                                    </h:panelGrid>
                                    <p:dataTable id="orderCommodities" value="#{orderManager.selectedOrder.orderCommodityCollection}" var="item" rowIndexVar="rowIndex">
                                        <p:column expansion="true"></p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="编码"/>
                                            </f:facet>
                                            <h:outputText value="#{item.number}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="名称"/>
                                            </f:facet>
                                            <h:outputText value="#{item.name}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="单价"/>
                                            </f:facet>
                                            <h:outputText value="#{item.unitPrice}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="数量"/>
                                            </f:facet>
                                            <h:outputText value="#{item.quantity}" />
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="类别"/>
                                            </f:facet>
                                            <h:outputText value="#{item.type}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="完工"/>
                                            </f:facet>
                                            <h:outputText value="#{item.completedAsString}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="出库"/>
                                            </f:facet>
                                            <h:outputText value="#{item.stockoutAsString}" />
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="退货"/>
                                            </f:facet>
                                            <h:outputText value="#{item.returnedQuantity}" />
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="取件"/>
                                            </f:facet>
                                            <h:outputText value="#{item.retrievedAsString}"/>
                                        </p:column>
                                        <p:column headerText="选项">
                                            <p:commandLink action="#{orderManager.deleteCommodity(item)}" update="form2:orderCommodities,form:growl,form2:receivable" >
                                                <p:graphicImage value="/resources/images/delete.png"/>
                                            </p:commandLink>
                                            <p:commandLink action="#{orderManager.editOrderCommodity(item)}"  oncomplete="handleEdityOrderCommodity(xhr, status, args);" update="form:growl,form6:orderServers" >
                                                <p:graphicImage value="/resources/images/edit.png"/>
                                            </p:commandLink>
                                        </p:column>
                                        <f:facet name="expansion" >
                                            <p:dataTable id="subOrderCommodities" value="#{item.subOrderCommodityCollection}" var="subOrderCommodity" rowIndexVar="rowIndex">

                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="编码"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.number}"/>
                                                </p:column>
                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="名称"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.name}"/>
                                                </p:column>
                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="数量"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.quantity}"/>
                                                </p:column>

                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="完成"/>
                                                    </f:facet>
                                                    <h:selectBooleanCheckbox value="#{subOrderCommodity.completedAsString}" disabled="true"/>
                                                </p:column>

                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="退货"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.returnedQuantity}" />
                                                </p:column>
                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="出库"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.stockoutAsString}" />
                                                </p:column>

                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="取件"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.retrievedAsString}"/>
                                                </p:column>
                                                <p:column>
                                                    <f:facet name="header">
                                                        <h:outputText value="服务人员"/>
                                                    </f:facet>
                                                    <h:outputText value="#{subOrderCommodity.serverInfo}"/>
                                                </p:column>

                                            </p:dataTable>
                                        </f:facet>
                                    </p:dataTable>
                                    <f:facet name="footer">
                                        <h:panelGroup>
                                            <p:commandButton  value="保存" disabled="#{orderManager.selectedOrder.cancelled} or #{orderManager.selectedOrder.settled} " actionListener="#{orderManager.save}"  update="form1:orders,form:growl,form3:accounts" ></p:commandButton>
                                            <p:commandButton  value="取件" disabled="#{orderManager.selectedOrder.cancelled}  or #{orderManager.selectedOrder.settled}" update="form7:orderCommoditiesForRetrieve" oncomplete="orderCommdoitiesForRetrieveDialog.show()"></p:commandButton>
                                            <p:commandButton  value="结单" disabled="#{orderManager.selectedOrder.cancelled}  or #{orderManager.selectedOrder.settled}" actionListener="#{orderManager.settle}"  update="form1:orders,form:growl"></p:commandButton>
                                            <p:commandButton  value="取消结单" disabled="#{orderManager.selectedOrder.cancelled}" rendered="#{p:ifGranted('admin')} and  #{orderManager.selectedOrder.settled}" actionListener="#{orderManager.cancelSettle}"  update="form1:orders,form:growl" ></p:commandButton>
                                        </h:panelGroup>
                                    </f:facet>
                                </h:panelGrid> 
                            </h:form>
                        </p:layoutUnit>

                        <p:layoutUnit position="right"  resizable="false" style="font-size: 75%" width="300"  scrollable="true">
                            <h:form id="form4">
                                <h:panelGroup>
                                    <p:dataTable id="selectedCommodities" value="#{commodityManager.commodityListForSelection}" var="item" rowIndexVar="rowIndex">
                                        <f:facet name="header">
                                            <h:panelGrid columns="2">
                                                <h:selectOneMenu value="#{commodityManager.commodityProperty}" id="commodityPropertyMenu">

                                                    <f:selectItems value="#{applicationBean.commdoityPropertyItems}"></f:selectItems>
                                                    <p:ajax  update="form4:selectedCommodities,form4:selectedCommodityTypes" listener="#{commodityManager.searchByPropertyForSelection}" />
                                                </h:selectOneMenu>
                                                <h:selectOneMenu id="selectedCommodityTypes" value="#{commodityManager.commodityType}">

                                                    <f:selectItems value="#{commodityManager.commodityTypeItems}"></f:selectItems>
                                                    <p:ajax  update="form4:selectedCommodities" listener="#{commodityManager.searchByTypeForSelection}" />
                                                </h:selectOneMenu>
                                            </h:panelGrid>
                                        </f:facet>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="序号"/>
                                            </f:facet>
                                            <h:outputText value="#{rowIndex}"/>
                                        </p:column>
                                        <p:column>
                                            <f:facet name="header">
                                                <h:outputText value="名称"/>
                                            </f:facet>
                                            <h:outputText value="#{item.name}"/>
                                        </p:column>
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputText value="编码"/>
                                            </f:facet>
                                            <h:outputText value="#{item.number}"/>
                                        </p:column>
                                        <p:column  >
                                            <f:facet name="header">
                                                <h:outputText value="单价"/>
                                            </f:facet>
                                            <h:outputText value="#{item.uitPrice}"/>
                                        </p:column>
                                        <p:column headerText="添加">
                                            <p:commandLink action="#{orderManager.addCommodity(item)}" title="添加零售商品" update="form2:orderCommodities,form:growl,form2:receivable" >
                                                <p:graphicImage value="/resources/images/add.png"/>
                                            </p:commandLink>
                                            <p:commandLink action="#{orderManager.addCommodityToPackage(item)}" title="添加套系商品" update="form:growl,form5:packageOrderCommodities" oncomplete="handleAddCommodityToPackage(xhr, status, args)">
                                                <p:graphicImage value="/resources/images/edit.png"/>
                                            </p:commandLink>
                                        </p:column>
                                    </p:dataTable>
                                </h:panelGroup>
                            </h:form>
                        </p:layoutUnit>
                    </p:layout>
                </p:dialog>
                <p:dialog widgetVar="packageCommdoitiesDialog" modal="true" width="300">
                    <h:form id="form5">
                        <p:dataTable id="packageOrderCommodities" value="#{orderManager.orderPackageCommodities}" var="item">
                            <f:facet name="header">
                                <h:outputLabel value="添加数量" for="quantity">
                                </h:outputLabel>
                                <h:inputText id="quantity" value="#{orderManager.commodityQuantityAddToPackage}" required="true" requiredMessage="请添加数量">
                                    <f:validateLongRange minimum="0"></f:validateLongRange>
                                </h:inputText>
                            </f:facet>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="编码"/>
                                </f:facet>
                                <h:outputText value="#{item.number}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="名称"/>
                                </f:facet>
                                <h:outputText value="#{item.name}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="选定"/>
                                </f:facet>
                                <p:commandLink action="#{orderManager.selectPackageToAdd(item)}" title="添加套系商品" update="form2:orderCommodities,form:growl" oncomplete="packageCommdoitiesDialog.hide()" >
                                    <p:graphicImage value="/resources/images/search.png"/>
                                </p:commandLink>
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </p:dialog>
                <p:dialog widgetVar="orderCommdoitiesForRetrieveDialog" modal="true" width="300" closable="false">
                    <h:form id="form7">
                        <p:dataTable id="orderCommoditiesForRetrieve" value="#{orderManager.orderCommoditesForRetrieve}" var="item">
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="编码"/>
                                </f:facet>
                                <h:outputText value="#{item.number}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="名称"/>
                                </f:facet>
                                <h:outputText value="#{item.name}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="取件"/>
                                </f:facet>
                                <h:selectBooleanCheckbox value="#{item.retrieved}"/>
                            </p:column>
                        </p:dataTable>
                        <p:commandButton  value="保存" actionListener="#{orderManager.saveOrderCommoditesForRetrieve}"  update="form:growl,form2:orderCommodities" oncomplete="handleSaveOrderCommodityForRetrieveRequest(xhr, status, args)"></p:commandButton>
                    </h:form>
                </p:dialog>
                <p:dialog widgetVar="orderCommdoitiesDialog" modal="true" width="600" header="编辑商品" closable="true">
                    <h:form id="form6">
                        <p:dataTable id="orderServers" value="#{orderManager.selectOrderCommodity.orderServerCollection}" var="orderServer" >
                            <f:facet name="header">
                                <h:panelGrid columns="4" columnClasses="column1,column2,column1,column2">
                                    <h:outputLabel value="商品:"/>
                                    <h:selectOneMenu value="#{orderManager.selectOrderCommodity}" >
                                        <f:selectItems value="#{orderManager.orderCommoditySelectItems}" />
                                        <p:ajax event="change" update="form6:orderServers"/>
                                    </h:selectOneMenu>
                                    <h:outputLabel value="退货:"/>
                                    <h:inputText value="#{orderManager.selectOrderCommodity.returnedQuantity}" size="3" disabled="#{orderManager.selectOrderCommodity.packaged}"/>
                                    <h:outputLabel value="数量:"/>
                                    <h:inputText value="#{orderManager.selectOrderCommodity.quantity}" size="3"/>
                                    <h:outputLabel value="出库数量:"/>
                                    <h:outputText value="#{orderManager.selectOrderCommodity.stockoutAsString}"  />
                                    <h:outputLabel value="单价:"/>
                                    <h:inputText value="#{orderManager.selectOrderCommodity.unitPrice}" size="6" disabled="#{orderManager.selectOrderCommodity.packaged}"/>
                                </h:panelGrid>
                            </f:facet>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="职位"/>
                                </f:facet>
                                <h:outputText value="#{orderServer.departpost.departmentPostInfo}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="数量提成"/>
                                </f:facet>
                                <h:outputText value="#{orderServer.quantityRoyalty}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="金额提成"/>
                                </f:facet>
                                <h:outputText value="#{orderServer.priceRoyalty}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="服务人员"/>
                                </f:facet>
                                <h:selectOneMenu  value="#{orderServer.server}">
                                    <f:selectItems  value="#{orderManager.serverSelectItems}" >
                                    </f:selectItems>
                                </h:selectOneMenu>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="介绍人提成"/>
                                </f:facet>
                                <h:inputText value="#{orderServer.introducerRoyalty}" size="2" required="true" requiredMessage="介绍人提成不可为空"/>
                            </p:column>
                        </p:dataTable>
                        <p:commandButton  value="保存" actionListener="#{orderManager.saveOrderCommodity}"  update="form:growl,form2:orderCommodities,form2:receivable" ></p:commandButton>
                    </h:form>
                </p:dialog>
                <p:dialog widgetVar="accountDialog" modal="true" width="600" >
                    <h:form id ="form3">
                        <p:dataTable id="accounts" value="#{accountManager.accounts}" var="item" paginator="true" rows="20"
                                     selectionMode="single" selection="#{orderManager.selectedOrder.account}"
                                     update="form2:display" onselectComplete="accountDialog.hide(); orderDialog.show();" >
                            <f:facet name="header">
                                <h:panelGrid columns="4" style="width: 300px">
                                    <h:outputLabel value="模糊查询"></h:outputLabel>
                                    <h:inputText value="#{accountManager.searchContent}" title="可输入部分男宾或女宾的姓名与电话进行查询"></h:inputText>
                                    <p:commandLink update="form3:accounts" actionListener="#{accountManager.search}" title="查询">
                                        <p:graphicImage value="/resources/images/search.png"/>
                                    </p:commandLink>
                                    <p:ajaxStatus  style="width:16px;height:16px;">
                                        <f:facet name="start">
                                            <h:graphicImage  value="/resources/images/ajaxloading.gif" />
                                        </f:facet>
                                        <f:facet name="complete">
                                            <h:outputText value="" />
                                        </f:facet>
                                    </p:ajaxStatus>
                                </h:panelGrid>
                            </f:facet>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Id"/>
                                </f:facet>
                                <h:outputText value="#{item.id}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="男宾姓名"/>
                                </f:facet>
                                <h:outputText value="#{item.mname}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="男宾电话"/>
                                </f:facet>
                                <h:outputText value="#{item.mphone}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="女宾姓名"/>
                                </f:facet>
                                <h:outputText value="#{item.fname}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="女宾电话"/>
                                </f:facet>
                                <h:outputText value="#{item.fphone}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="固定电话"/>
                                </f:facet>
                                <h:outputText value="#{item.phone}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="结婚日期"/>
                                </f:facet>
                                <h:outputText value="#{item.marriageDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </p:dialog>
            </f:view>
        </ui:define>
    </ui:composition>
</html>
